<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        .box{
            width: 250px;
            margin: auto;
        }
        .sinput{
            width: 250px;
            height: 40px;
            border: 1px solid #e0e0e0;
            outline: none;
        }
        .dropdown{
            display: none;
            border: 1px solid #ff6700;
            width: 250px;
        }
        .dropdown li{
            list-style: none;
            padding-left: 5px;
            
        }
        li:hover{
            background-color: #ff6700;
        }
        div .bc{
            color:#ff6700 ;
        }
    </style>
</head>
<body>
    <di class="box">
        <input class="sinput" type="text" placeholder="小米笔记本" >
        <ul class="dropdown">
            <li>全部商品</li>
            <li>小米11</li>
            <li>小米10s</li>
            <li>小米笔记本</li>
            <li>小米手机</li>
            <li>黑鲨4</li>
            <li>空调</li>
        </ul>
    </div>
</body>
<script>
    const sinput = document.querySelector('.sinput')
    const dropdown = document.querySelector('.dropdown')
    dropdown.style.display = 'none'
    sinput.addEventListener('focus',function(){
        dropdown.style.display='block'
        sinput.classList.add('bc')
    })
    sinput.addEventListener('blur',function(){
        dropdown.style.display='none'
        sinput.classList.remove('bc')
    })
</script>
</html>